﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SyntheticPay.aspx.cs" Inherits="WeChat.JsSDK.WxPay.SyntheticPay" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
 <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/> 
    <link href="../../css/payh5.css" rel="stylesheet" type="text/css" />
    <link href="../../css/weui.css" rel="stylesheet" type="text/css" />
<script src="../../bootstrap-3.3.5-dist/js/jquery-1.11.3.min.js" type="text/javascript"></script>
<title>功德分充值</title>
    <script type="text/javascript"> 
        // 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            $('#submit').click(function (e) {
                //$('#dialog2').show();

                WeixinJSBridge.invoke(
                    'getBrandWCPayRequest',
            <%=wxJsApiParam%>,//josn串
                function (res) {
                    WeixinJSBridge.log(res.err_msg);
                    //alert(res.err_code + res.err_desc + res.err_msg);
                    if (res.err_msg == "get_brand_wcpay_request:ok") {
                        //alert("您已成功支付订单！");
                        // window.location.replace("http://www.xjchtz.com/JsSDK/WxPay/PayResult.aspx");
                    }
                    else if (res.err_msg == "get_brand_wcpay_request:cancel") {
                        //alert("您取消本次支付!");
                        //window.location.replace("http://www.xjchtz.com/JsSDK/WxPay/PayResult.aspx?fail=true");
                    }
                    else {
                        //alert("支付失败！错误信息：" + res.err_msg);
                        //  window.location.replace("http://www.xjchtz.com/JsSDK/WxPay/PayResult.aspx?fail=true");
                    }
                    // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                    //因此微信团队建议，当收到ok返回时，向商户后台询问是否收到交易成功的通知，若收到通知，前端展示交易成功的界面；若此时未收到通知，商户后台主动调用查询订单接口，查询订单的当前状态，并反馈给前端展示相应的界面。
                });
            });
            WeixinJSBridge.log('yo~ ready.');
        },
            false)                       
</script>
<script type="text/javascript">
    window.onload = function () {
        var aA = document.getElementById("inp").getElementsByTagName("li");
        var aLi = document.getElementById("ali");
        var inNum = document.getElementById("inNum");

        inNum.onkeyup = function () {
            this.value = this.value.replace(/\D/g, '');
            aLi.innerHTML = "￥" + this.value;
            $("#selVal").val(this.value);
        }
        for (var i = 0; i < aA.length; i++) {
            aA[i].index = i;
            aA[i].onclick = function () {
                for (var i = 0; i < aA.length; i++) {
                    aA[i].className = "";
                }
                this.className = "current"
                aLi.innerHTML = '￥' + this.innerHTML.replace(/\D/g, '');
                $("#selVal").val(this.innerHTML.replace(/\D/g, ''));
            };
        };

        //  var oBtn=document.getElementById("btn1")
        //  oBtn.onclick=function()
        //  {
        //    this.style.background="#6CE26C"
        //  };
        // oBtn.onmouseout=function()
        //  {
        //	  this.style.background=" #04be02";
        //  };	  		

    };
    function check() {
        if ($("#ali").text() == "￥") {
            $("#dialog").show();
            return false;
        } else {
            return true;
        }
    }

</script>
</head>


<body>
<form id="Form1" runat="server">
<div class="bodywrap">
    <div class="top">
        <h1><span>扫码支付</span></h1>
    </div>
    <div class="qxz">
        <label>请输入支付的金额：</label>
    </div>
    <div class="inputbox">
        <div class="inp" id="inp">
            <ul>
              
                <li style="width:95%"><input id="inNum" type="tel"  value="" maxlength="" autocomplete="off" placeholder="输入金额" style="margin:0;"/></li>
            </ul>
        </div>
    </div>
    <div class="sj" id="sj">
        <ul>
            <li style="display:block">应付金额:<span id="ali">￥0</span></li>
        </ul>
    </div>
    <div id="Div1" class="tj">
        <asp:Button ID="btn1" runat="server" Text="点此支付" CssClass="weui_btn weui_btn_primary" OnClick="btn1_Click" OnClientClick="return check()" />
    </div>
    <input id="selVal" name="selVal" type="hidden" value="0" />
</div>
<%--<div class="weui_dialog_alert" id="dialog" style="display: none;">
    <div class="weui_mask"></div>
    <div class="weui_dialog">
        <div class="weui_dialog_hd"><strong class="weui_dialog_title">提示</strong></div>
        <div class="weui_dialog_bd">请选择充值功德分！</div>
        <div class="weui_dialog_ft">
            <a id="A1" href="javascript:$('#dialog').hide();" class="weui_btn_dialog- primary">关闭</a>
        </div>
    </div>
</div>--%>
</form>
</body>
</html>